
package com.sec.android.app.myfiles.module.local.category;

import android.provider.MediaStore;

import com.sec.android.app.myfiles.info.FileType;
import com.sec.android.app.myfiles.provider.DbTableInfo;

public class CategoryDbTableInfo extends DbTableInfo {

    private static CategoryDbTableInfo mInstance = null;

    public static DbTableInfo getInstance() {
        if (mInstance == null) {
            mInstance = new CategoryDbTableInfo();
        }
        return mInstance;
    }

    protected CategoryDbTableInfo() {
        String isDirQuery = "CASE WHEN format = " + FileType.FOLDER + " THEN 1 ELSE 2 END";
        mTableColumn.add(new DB_Column(COLUMN_ID.ID, "_id", "integer PRIMARY KEY"));
        mTableColumn.add(new DB_Column(COLUMN_ID.PATH, "_data", "text"));
        mTableColumn.add(new DB_Column(COLUMN_ID.NAME, "_display_name", "text"));
        mTableColumn.add(new DB_Column(COLUMN_ID.SIZE, "_size", "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.DATE, "date_modified", "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.FILE_TYPE, "media_type", "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.MIME_TYPE, "mime_type", "text"));
        mTableColumn.add(new DB_Column(COLUMN_ID.EXT, "ext", null, EXT_QUERY + " AS ext"));
        mTableColumn.add(new DB_Column(COLUMN_ID.FORMAT, "format", "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.IS_DIRECTORY, "isDirectory", null, isDirQuery));

        mTableColumn.add(new DB_Column(COLUMN_ID.WIDTH, MediaStore.Files.FileColumns.WIDTH, "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.HEIGHT, MediaStore.Files.FileColumns.HEIGHT, "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.DURATION, MediaStore.Video.VideoColumns.DURATION, "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.RESUME_POS, "resumePos", "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.ARTIST, MediaStore.Audio.AlbumColumns.ARTIST, "text"));
        mTableColumn.add(new DB_Column(COLUMN_ID.ALBUM, MediaStore.Audio.AlbumColumns.ALBUM, "integer"));

        mTableColumn.add(new DB_Column(COLUMN_ID.SEF_FILE_TYPE, COLUMN_NAME_SEF_FILE_TYPE, "integer"));
        mTableColumn.add(new DB_Column(COLUMN_ID.IS_360_VIDEO, COLUMN_NAME_GEAR360_VIDEO, "integer"));
    }

    @Override
    public String getTableName() {
        final String tableName = "category";
        return tableName;
    }

    @Override
    public boolean isRealDb() {
        return false;
    }

}
